package org.john.javalib;

import java.io.*;
import java.util.Scanner;

/**
 * Created by adsame on 19-9-10.
 */
public class FileTest {
    public static void main(String args[]) {
        File file = new File("src/data/test_read.txt");
        try {
            FileReader fr = new FileReader(file);
            BufferedReader br = new BufferedReader(fr);
//            FileInputStream fis = new FileInputStream(file);
//            ObjectInputStream ois = new ObjectInputStream(fis);
//            String str = (String)ois.readObject();
            String str = br.readLine();
            System.out.println("first time:" + str);
            Scanner scanner = new Scanner(System.in);
            String input = scanner.nextLine();
            System.out.println(input);
//            fis = new FileInputStream(file);
//            ois = new ObjectInputStream(fis);
//            str = (String)ois.readObject();
            fr = new FileReader(file);
            br = new BufferedReader(fr);
            str = br.readLine();
            System.out.println("second time:" + str);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
//        } catch (ClassNotFoundException e) {
//            e.printStackTrace();
        }
    }
}
